//
//  StartGame.h
//  Game2048
//
//  Created by fengyi on 15/8/20.
//
//

#ifndef __Game2048__StartGame__
#define __Game2048__StartGame__

#include "cocos2d.h"
#include "GameDefine.h"
#include "NumTile.h"
#include "SimpleAudioEngine.h"

using namespace CocosDenshion;
USING_NS_CC;
class StartGame : public Layer
{
public:
    CREATE_FUNC(StartGame);
    static Scene* createScene();
    void moveAllTile(Move_Dir dir);
    void moveUp();
    void moveDown();
    void moveLeft();
    void moveRight();
    void newTile(float dt); //产生新块
    void restart(); //重新开始
    bool canMove(); //满屏时能否消除
    void setAudioEfx();
    void restart_callback();
    void restart_cancel();
    void restart_ok();
    void stopCallBack();
    void stopGame();
    static unsigned int score; //分数
    void doubleClickCallBack(float dt);
private:
    Label* score_label;
    LayerColor* bg;
    bool init();
    int m_map[ROW][COL];
    Vector<NumTile*> m_vec;
    bool b_startMover; //能否触摸
    bool isMoved; //有没移动块
    bool isEliminate;//有没消除块
    int m_x,m_y;  //触摸开始点坐标
    bool isDoubleClick;
};
#endif /* defined(__Game2048__StartGame__) */
